<?php
session_start();
include "conn/conn.php";
include "inc/func.php";
?>
<link href="css/style.css" rel="stylesheet" />
<script src="js/client_js.js"></script>
<script language=JavaScript>
document.onclick = clickHandler;
</script>
<table border="0" cellpadding="0" cellspacing="0" width="203" height="509" background="images/left.jpg">
	<tr>
		<td height="20"></td>
	</tr>
	<tr>
		<td align="center" valign="top">
			<?php
			//Output first menu, visible
			$sqlstr_1 = "select f_type from tb_list group by f_type order by id";
			$t_result = mysql_query($sqlstr_1,$conn);
			$level_1_num = 0;
			while($t_rows = mysql_fetch_array($t_result))
			{
				echo "<div id=div".$level_1_num." class = left_menu style='background-color:#DEEBEF;'>";
				echo "<label id=div".$level_1_num." class = Outline style='cursor:hand;'>";
				echo "<img src=images/jia.gif id=div".$level_1_num."img name=div".$level_1_num."img/>".$t_rows[f_type]."</label>";
					
				//Output second menu, default : invisible
				$sqlstr = "select * from tb_list where f_type='".$t_rows[f_type]."'";
				$result = mysql_query($sqlstr,$conn);
				echo "<div id=div".$level_1_num."details class = left_menu style=\"display:none; position:relative; left:35;\">";
				while($rows = mysql_fetch_array($result))
				{
					if($rows[o_group] == "0")	//visible to everyone
					{
						echo "<img src=images/folder.gif /><U><a href='".$rows[o_url]."?u_id=".$rows[id]."' target=mainFrame>".$rows[f_name]."</a></U><br/>";
					}
					else		//only visible to specified group
					{
						$bool = false;
						$g_list = explode(",",$rows[o_group]);	//This function has been DEPRECATED as of PHP 5.3.0. So, split->explode
						for($i=0;$i<count($g_list);$i++)
						{
							if($_SESSION[u_group] == $g_list[$i])
							{
								$bool = true;
								break;
							}
						}
						if($bool)
						{
							echo "<img src=images/folder.gif /><U><a href='".$rows[o_url]."?u_id=".$rows[id]."' target=mainFrame>".$rows[f_name]."</a></U><br/>";	
						}
					}
				}
				echo "</div></div>";
				$level_1_num++;	
			}
			?>	
		</td>
	</tr>
	<tr>
		<td colspan="2" height="54" background="images/left_top.jpg">&nbsp;</td>
	</tr>
</table>